package com.gykj.rtm.facade.admin;

import java.util.List;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;
import com.gykj.admin.common.entity.User;
import com.gykj.admin.common.entity.UserRole;
import com.gykj.admin.common.resp.RespResultJson;
import com.gykj.rtm.feign.fallback.UserFacadeHystrixImpl;

@FeignClient(value = "gykj-admin-service", fallback = UserFacadeHystrixImpl.class)
public interface UserFacade {
	
    @RequestMapping(value = "/users/getAllUserList")
    public PageInfo<User> getAllUserList(
    		@RequestBody User user,
            @RequestParam(value="currentPage",required = false, defaultValue = "1") int currentPage,
            @RequestParam(value="pageSize",required = false, defaultValue = "20") int pageSize,
            @RequestParam(value="sortColumn",required = false, defaultValue = "1") int sortColumn,
            @RequestParam(value="sortDesc",required = false, defaultValue = "1") int sortDesc
           );
    
    @RequestMapping(value = "/users/getUserById")
    public List<User> getUserById(@RequestParam(value="uid",required=false) Integer uid);

	/**
	 * 保存用户角色
	 * @param userRole
	 * 用户角色 此处获取的参数的角色id是以 “,” 分隔的字符串
	 * @return
	 */
    @RequestMapping(value = "/users/saveUserRoles",method = RequestMethod.POST)
    public RespResultJson saveUserRoles(@RequestBody UserRole userRole);

	@RequestMapping(value = "/users/addUser", method = RequestMethod.POST)
	public RespResultJson addUser(@RequestBody User user);

	@RequestMapping(value = "/users/deleteUser", method = RequestMethod.GET)
	public RespResultJson deleteUser(@RequestParam(value="id",required=false) Integer id);
}
